#include <math.h>
#include <stdlib.h>
#include "StressTask.hh"
#include <unistd.h>

Average StressTask::ResponseTime;

StressTask::StressTask()
{
	Count = 10000;
	Timer.start();
}

StressTask::StressTask(void* Data)
{
	ResultOf Result;
	Result = setData(Data);
	checkErrorWOR(Result, "Fail setData.");
}

ResultOf StressTask::perform()
{
// 	Number Stress = 0xCCCCCCCC;
// 	for (Number LC = 0; LC < Count; LC++)
// 		Stress *= LC;
	
	Timer.stop();
	ResponseTime.addData(Timer.tellMicroSec());
	return RETURN_OK;
}

ResultOf StressTask::setData(void* Data)
{
	Count = (USNumber)Data;
	return RETURN_OK;
}

double StressTask::tellResponseTime()
{
	return ResponseTime.tellAverage();
}
